
window.onload = function () {
  const img = document.querySelectorAll('.img')
  const tasknum = document.querySelector('.tasknum')
  const big = document.querySelectorAll('.Public_Style .big')
  const Public_Style = document.querySelectorAll('.Public_Style')
  const backBtn = document.querySelector('.header .content img')
  let sum = 0
  //顶部返回上一级
  backBtn.addEventListener('touchstart', () => {
    history.go(-1)
  })

  Array.from(img).map(function (item, index) {
    let num = 1
    if (index === 0) {
      item.addEventListener('touchstart', ()=>{
        const flag1=index

      
        if(num%2==1){
        big[index].style.display = 'none'
        tasknum.style.height = '55px'
        item.src = "images/红＋.png"
        num++
       }
        else {
        big[index].style.display = 'block'
        tasknum.style.height = '363px'
        item.src = "images/红杠.png"
        num++
        }
      })
  }

  //   if (index >=0) {
  //     item.addEventListener('touchstart', function (e) {
  //       const flag2 = index
  // console.log(index)

  //       console.log(flag2);
  //     sum++
  //       if (e.target.dataset.id == flag2) {
        
  //         if (sum%2 == 1){
  //           big[index].style.opacity = 0
  //           Public_Style[index].style.height = '55px'
  //           item.src = "images/红＋.png"
  //         }
  //         else{
  //           big[index].style.opacity = 1
  //           // Public_Style.style.height = '363px'
  //           item.src = "images/红杠.png"
  //         // console.log(num1)
  //         }
  //      }
  //     })
  //   }
  })
  const car=document.querySelector('.Driver_Information .img')
  car.addEventListener('touchstart', () => {
    hide('Driver_Information')
  })
  const transport_route=document.querySelector('.transport_route .img')
  transport_route.addEventListener('touchstart', () => {
    hide('transport_route')
  })
  const Driver_Information=document.querySelector('.Driver_Informations .img')
  Driver_Information.addEventListener('touchstart', () => {
    hide('Driver_Informations')
  })
  const transport_news = document.querySelector('.transport_news .img')
  transport_news.addEventListener('touchstart', () => {
    hide('transport_news')
  })
  function hide(item) {
    const imgs=document.querySelector(`.${item} .img`)
    // const bigbox = document.querySelector(`.${item} .big1`)
    imgs.classList.toggle('show')
    const istrue = imgs.classList.contains('show')
    if (istrue) {
      imgs.nextElementSibling.style.display = 'none'
      imgs.src = "images/红＋.png"
      // imgs.src = "images/红杠.png"
    } else {
      imgs.nextElementSibling.style.display = 'block'
      imgs.src = "images/红杠.png"
      // imgs.src= "images/红＋.png"
    }
  }

  const getnums=document.querySelector('.logistics span')
 const nummm=localStorage.getItem('tasknum')
getnums.innerHTML=nummm
}

  
